/**
 * Copyright (c) 2014-2015, Suredy technology Co., Ltd. All rights reserved.
 * @author ZhangMaoren 
 * @since 2015年4月27日
 * @version 0.1
 */
package com.suredy.base.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;


/**
 * @author ZhangMaoren
 *
 */
@Entity
@Table(name = "T_SECURITY_ROLE2PERMISSION")
public class Role2Permission implements Serializable {


	/**
	 * 
	 */
	private static final long serialVersionUID = -4529646227556472193L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID")
	private Long id;
	
	@Column(name = "ROLEID", length = 32)
	private String roleId;
	
	@Column(name = "PERMISSIONID")
	private Long permissionId;
	
	
	
	
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	
	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	
	/**
	 * @return the roleId
	 */
	public String getRoleId() {
		return roleId;
	}

	
	/**
	 * @param roleId the roleId to set
	 */
	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	
	/**
	 * @return the permissionId
	 */
	public Long getPermissionId() {
		return permissionId;
	}

	
	/**
	 * @param permissionId the permissionId to set
	 */
	public void setPermissionId(Long permissionId) {
		this.permissionId = permissionId;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Role2Permission that = (Role2Permission) o;
		if (id != null ? !id.equals(that.id) : that.id != null){
			return false;
		}
		if (permissionId != null ? !permissionId.equals(that.permissionId) : that.permissionId != null){
			return false;
		}
		if (roleId != null ? !roleId.equals(that.roleId) : that.roleId != null){
			return false;
		}

		return true;
	}

	@Override
	public int hashCode() {
		int result = (id != null ? id.hashCode() : 0);
		result += (roleId != null ? roleId.hashCode() : 0);
		result += (permissionId != null ? permissionId.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "Role2Permssion[id=" + id + ", roleId=" + roleId + ", permissionId="
				+ permissionId + "]";
	}

}
